package com.bjsxt.base.lockDesign.design1;

public class Test {
    UnReLock lock = new UnReLock();

    public void print() throws InterruptedException {
        lock.lock();
        doAdd(); // 若lock不可重入则无法执行doAdd中间的do something, 若可重入则可以
        lock.unlock();
    }

    public void doAdd() throws InterruptedException {
        lock.lock();
        //do something
        lock.unlock();
    }
}
